package com.education.welco.service.impl;

import com.education.common.utils.Convert;
import com.education.welco.mapper.MessageNotificationMapper;
import com.education.welco.pojo.MessageNotification;
import com.education.welco.service.IMessageNotificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 消息通知 服务层实现
 *
 * @Author: liftsail
 * @Date: 2022-10-17
 * @Description: 不积跬步无以至千里
 */
@Service
public class MessageNotificationServiceImpl implements IMessageNotificationService {

    @Autowired
    private MessageNotificationMapper messageNotificationMapper;

    /**
     * 查询消息通知信息
     *
     * @param messageId 消息通知ID
     * @return 消息通知信息
     */
    @Override
    public MessageNotification selectMessageNotificationById(Integer messageId) {
        return messageNotificationMapper.selectMessageNotificationById(messageId);
    }

    /**
     * 查询消息通知列表
     *
     * @param messageNotification 消息通知信息
     * @return 消息通知集合
     */
    @Override
    public List<MessageNotification> selectMessageNotificationList(MessageNotification messageNotification) {
        return messageNotificationMapper.selectMessageNotificationList(messageNotification);
    }

    /**
     * 新增消息通知
     *
     * @param messageNotification 消息通知信息
     * @return 结果
     */
    @Override
    public int insertMessageNotification(MessageNotification messageNotification) {
        return messageNotificationMapper.insertMessageNotification(messageNotification);
    }

    /**
     * 修改消息通知
     *
     * @param messageNotification 消息通知信息
     * @return 结果
     */
    @Override
    public int updateMessageNotification(MessageNotification messageNotification) {
        return messageNotificationMapper.updateMessageNotification(messageNotification);
    }

    /**
     * 删除消息通知对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteMessageNotificationByIds(String ids) {
        return messageNotificationMapper.deleteMessageNotificationByIds(Convert.toStrArray(ids));
    }

    /**
     * 批量更改消息的阅读状态
     * @param messageIdList
     * @return
     */
    @Override
    public int batchUpdateReadState(List<Integer> messageIdList) {
        return messageNotificationMapper.batchUpdateReadState(messageIdList);
    }
}